import sys
import tarfile
-def get(url, path):
+def get(url, path, quiet=False):
# see http://serverfault.com/questions/301128/how-to-download
if sys.platform == 'win32':
run(["PowerShell.exe", "/nologo", "-Command",
"(New-Object System.Net.WebClient).DownloadFile('" + url +
- "', '" + path + "')"])
+ "', '" + path + "')"], quiet=quiet)
else:
- run(["curl", "-o", path, url])
+ run(["curl", "-o", path, url], quiet=quiet)
def unpack(tarball, dst, quiet=False):
if quiet:
import subprocess
import sys
import hashlib
+import download
date = sys.argv[1]
for platform in sorted(snaps):
triple = snaps[platform]
tarball = 'cargo-nightly-' + triple + '.tar.gz'
- url = 'https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/' + date + '/' + tarball
+ url = 'https://static.rust-lang.org/cargo-dist/' + date + '/' + tarball
dl_path = "target/dl/" + tarball
- ret = subprocess.call(["curl", "-f", "-s", "-o", dl_path, url])
- if ret != 0:
- raise Exception("failed to fetch url")
+ download.get(url, dl_path, quiet = True)
h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
print(' ' + platform + ' ' + h)